package middleware

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"net/url"
)

type AuthCft struct {
	signature func(url.Values, string) string
	secretKey string
}

func Auth(cfg *AuthCft) gin.HandlerFunc {
	return func(c *gin.Context) {
		query := c.Query("sign")
		if query == "" {
			c.JSON(http.StatusBadRequest, "400 Bad Request")
			c.Abort()
		}
		c.Next()
	}
}
